//>>built
define("dojox/gfx/Moveable",["dojo/_base/lang","dojo/_base/declare","dojo/_base/array","dojo/_base/event","dojo/topic","dojo/touch","dojo/dom-class","dojo/_base/window","./Mover"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9){
return _2("dojox.gfx.Moveable",null,{constructor:function(_a,_b){
this.shape=_a;
this.delay=(_b&&_b.delay>0)?_b.delay:0;
this.mover=(_b&&_b.mover)?_b.mover:_9;
this.events=[this.shape.connect(_6.press,this,"onMouseDown")];
},destroy:function(){
_3.forEach(this.events,this.shape.disconnect,this.shape);
this.events=this.shape=null;
},onMouseDown:function(e){
if(this.delay){
this.events.push(this.shape.connect(_6.move,this,"onMouseMove"),this.shape.connect(_6.release,this,"onMouseUp"));
this._lastX=e.clientX;
this._lastY=e.clientY;
}else{
new this.mover(this.shape,e,this);
}
_4.stop(e);
},onMouseMove:function(e){
if(Math.abs(e.clientX-this._lastX)>this.delay||Math.abs(e.clientY-this._lastY)>this.delay){
this.onMouseUp(e);
new this.mover(this.shape,e,this);
}
_4.stop(e);
},onMouseUp:function(e){
this.shape.disconnect(this.events.pop());
this.shape.disconnect(this.events.pop());
this.shape.disconnect(this.events.pop());
this.shape.disconnect(this.events.pop());
},onMoveStart:function(_c){
_5.publish("/gfx/move/start",_c);
_7.add(_8.body(),"dojoMove");
},onMoveStop:function(_d){
_5.publish("/gfx/move/stop",_d);
_7.remove(_8.body(),"dojoMove");
},onFirstMove:function(_e){
},onMove:function(_f,_10){
this.onMoving(_f,_10);
this.shape.applyLeftTransform(_10);
this.onMoved(_f,_10);
},onMoving:function(_11,_12){
},onMoved:function(_13,_14){
}});
});
